<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>小婷专辑</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }
        .player-container {
            width: 80%;
            max-width: 800px;
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
        video {
            width: 100%;
            display: block;
            margin-bottom: 10px;
            border-radius: 4px;
        }
        .playlist {
            margin-top: 20px;
        }
        .playlist-item {
            padding: 10px;
            border-bottom: 1px solid #eee;
            cursor: pointer;
        }
        .playlist-item:hover {
            background-color: #f9f9f9;
        }
        .playlist-item.active {
            background-color: #e8f5e9;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <div class="player-container">
        <video id="videoPlayer" controls>
            <source src="/videos/sample-video1.mp4" type="video/mp4">
            您的浏览器不支持HTML5视频标签。
        </video>
        <div class="playlist" id="playlist">
            <h3>播放列表</h3>
            <div class="playlist-item active" data-url="/videos/sample-video1.mp4">小婷旅游记</div>
            <div class="playlist-item" data-url="/videos/sample-video2.mp4">小婷自拍（美颜版）</div>
            <div class="playlist-item" data-url="/videos/sample-video3.mp4">小婷自拍（素颜）</div>
            <div class="playlist-item" data-url="/videos/sample-video4.mp4">小婷超美版</div>
            <div class="playlist-item" data-url="/videos/sample-video5.mp4">小婷超可爱版</div>
            <div class="playlist-item" data-url="/videos/sample-video7.mp4">小婷歪头杀</div>
            <div class="playlist-item" data-url="/videos/sample-video9.mp4">拜托~拜托~</div>

        </div>
    </div>

    <script>
        const videoPlayer = document.getElementById('videoPlayer');
        const playlistItems = document.querySelectorAll('.playlist-item');

        playlistItems.forEach(item => {
            item.addEventListener('click', () => {
                // 移除所有active类
                playlistItems.forEach(playlistItem => {
                    playlistItem.classList.remove('active');
                });
                // 添加active类到当前项
                item.classList.add('active');
                // 加载视频<source src="/videos/sample-video.mp4" type="video/mp4">
                videoPlayer.src = item.dataset.url;
                videoPlayer.load();
                videoPlayer.play().catch(e => {
                    console.log("自动播放被阻止:", e);
                });
            });
        });
    </script>
</body>
</html>
